"""
    面向对象：多态
"""

class Bird:
    def __init__(self, name):
        self.name = name

class Fish:
    def __init__(self, name):
        self.name = name

class Dog:
    def __init__(self, name):
        self.name = name

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def call(self, flag):
        ani = None
        match flag:
            case '1':
                ani = Bird("红火")
            case '2':
                ani = Fish("小鱼儿")
            case '3':
                ani = Dog("wangc")
        return ani

    def feed(self, ani):
        print(f"{self.name},正在悉心喂养他的小动物{ani.name}")

person = Person("小佳", 30)
print(person.call("3"))

y1 = Fish("小鱼儿")
d1 = Dog("ahuang")
b1 = Bird("飞飞")
person.feed(y1)
person.feed(d1)
person.feed(b1)

